package com.company.dao.impl;

import com.company.dao.UserDao;
import com.company.pojo.User;

import java.util.List;
import java.util.Map;
import java.util.Properties;

/**
 * @ClassName UserDaoImpl
 * @Description User实现类
 */
public class UserDaoImpl implements UserDao {

    /* 演示注入数据的三种数据类型 */
    private String userName;
    private int age;
    private List<String> stringList;
    private Map<String, User> userMap;
    private Properties properties;

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setStringList(List<String> stringList) {
        this.stringList = stringList;
    }

    public void setMap(Map<String, User> userMap) {
        this.userMap = userMap;
    }

    public void setUserMap(Map<String, User> userMap) {
        this.userMap = userMap;
    }

    public void setProperties(Properties properties) {
        this.properties = properties;
    }

    public UserDaoImpl() {
        System.out.println("创建 UserDaoImpl ······ ");
    }

    /* Bean 的生命周期 | 初始化方法 */
    public void myInitMethod(){
        System.out.println("初始化方法······");
    }

    @Override
    public void save() {
        System.out.println("保存用户信息！");
    }

    /* Bean 的生命周期 | 销毁方法 */
    public void myDestroyMethod(){
        System.out.println("销毁方法······");
    }

    @Override
    public String toString() {
        return "UserDaoImpl{" +
                "userName='" + userName + '\'' +
                ", age=" + age +
                ", stringList=" + stringList +
                ", userMap=" + userMap +
                ", properties=" + properties +
                '}';
    }
}
